package com.yupi.springbootinit.bizmq;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

import static com.yupi.springbootinit.bizmq.BIMqConstant.BI_EXCHANGE_NAME;
import static com.yupi.springbootinit.bizmq.BIMqConstant.BI_ROUTING_KEY;

@Component
public class BiMessageProducer {
    
    @Resource
    private RabbitTemplate rabbitTemplate;
    
    public void sendMessage(String message){
        
        //发送消息
        rabbitTemplate.convertAndSend(BI_EXCHANGE_NAME,BI_ROUTING_KEY,message);
    }
    
    
}
